<?php

use think\migration\Migrator;
use think\migration\db\Column;

class Notices extends Migrator
{
    public function up()
    {
        $users = $this->table('notices', array('comment' => '通知消息'));
        $users->addColumn('messages_id', 'integer', array('limit' => 5, 'comment' => '信息id'))
              ->addColumn('sender', 'uuid', array('comment' => '发件人'))        
              ->addColumn('recipients', 'uuid', array('comment' => '收件人'))
              ->addColumn('reading', 'integer', array('limit' => 1, 'default' => 0, 'comment' => '是否阅读'))
              ->addColumn('send_time', 'timestamp', array('default' => 'CURRENT_TIMESTAMP', 'comment' => '发送时间'))
              ->addColumn('read_time', 'timestamp', array('null' => true, 'comment' => '阅读时间'))
              ->save();     
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('notices');
    }
}
